;
; vmpop.asm
;

include vmbdoor.inc

; enable x486 instructions, but use 16 bit segment
.486
option segment:use16

; code segment
codes	segment para use16 public 'CODE'
codes	ends

; data segment
datas	segment byte use16 public 'DATA'
BDOOR_MAGIC	dword  	VMWARE_MAGIC
BDOOR_PORT  	word	VMWARE_PORT
datas	ends

main	group codes,datas

codes	segment
; for tiny memory model (.com), all seg is the same
assume	cs:main,ds:main,es:main,ss:main
org	100h
entry:
	; Get VMware version
        mov 	eax, [BDOOR_MAGIC]
        mov 	dx, [BDOOR_PORT]
	xor 	ecx,ecx
	mov 	cl, VMCMD_GET_VERSION
        in 	eax, dx

	; Check Magic number
	cmp	ebx,[BDOOR_MAGIC]
	jne	terminate

	; Show popup dialog
	mov	eax, ebx
	mov	cl, VMCMD_POPUP_DIALOG
	mov	dx, [BDOOR_PORT]
	in	eax, dx

terminate:
	xor	al, al
	mov	ah, 4ch
	int	21h
	; this function never returnes

codes	ends
end	entry
; end of file
